package com.cskaoyan.gateway.controller.user;

import com.mall.commons.result.ResponseData;
import com.mall.commons.result.ResponseUtil;
import com.mall.user.IVerifyService;
import com.mall.user.annotation.Anoymous;
import com.mall.user.constants.SysRetCodeConstants;
import com.mall.user.dto.UserVerifyRequest;
import com.mall.user.dto.UserVerifyResponse;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RequestMapping("/user")
public class VerifyController {

    @Reference
    private IVerifyService verifyService;

    @RequestMapping("/verify")
    @Anoymous
    public String getVerify(String uid, String username) {
        UserVerifyRequest request = new UserVerifyRequest();
        request.setUuid(uid);
        request.setUserName(username);
        UserVerifyResponse response = verifyService.verify(request);
        if(SysRetCodeConstants.SUCCESS.getCode().equals(response.getCode())){
            return "success";
        }
        return "fail";
    }
}
